﻿using MediatR;
using T_vehicle.Domain;
using T_vehicle.Infrastructure.Interfacec;
using T_vehicle.Read.API.Application.Command.ExpensesCommand;

namespace T_vehicle.Read.API.Application.CommandHandlers.ExpensesCommandHandlers
{
    public class FanExpensesCommandHandlers:IRequestHandler<FanExpensesCommand,Expenses>
    {
        private readonly IExpensesRepository expensesRepository;

        public FanExpensesCommandHandlers(IExpensesRepository expensesRepository)
        {
            this.expensesRepository = expensesRepository;
        }

        public async Task<Expenses> Handle(FanExpensesCommand request, CancellationToken cancellationToken)
        {
            var list = expensesRepository.GetModelAsync(request.ExpensesId);
            return await list;
        }
    }
}
